package com.ynu.znkz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ynu.znkz.entity.User;
import com.ynu.znkz.mapper.UserMapper;
import com.ynu.znkz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 根据用户名和密码获取用户信息
     * @param username
     * @param password
     * @return
     */
    @Override
    public User getByUserNameAndPassword(String username, String password) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", username);
        queryWrapper.eq("password", password);
        return baseMapper.selectOne(queryWrapper);
    }
}
